﻿using System;
using System.Configuration;
using System.Data.Linq;
using System.Linq;
using Controllers;

namespace Web
{
    public partial class VehiInfo : System.Web.UI.Page
    {
        protected ReqVehicleMains reqVehicleMains;
        protected string empName;
        protected void Page_Load(object sender, EventArgs e)
        {
            string formNo = Request.QueryString["formNo"];
            ApolloOaDataContext ctx = new ApolloOaDataContext(ConfigurationManager.ConnectionStrings["SqlConnectionString"].ConnectionString);
            DataLoadOptions dlo = new DataLoadOptions();
            dlo.LoadWith<ReqVehicleMains>(r => r.ReqVehicleSubs);
            ctx.LoadOptions = dlo;
            reqVehicleMains = ctx.ReqVehicleMains.Single(r => r.FormNo == formNo);

            rptList.DataSource = reqVehicleMains.ReqVehicleSubs;
            rptList.DataBind();
            Employee employee = ctx.Employees.Single(r => r.Id == reqVehicleMains.EmpId);
            empName = employee.Name;
        }
    }
}